﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.ComponentModel;
using ShootSearch.Util;

namespace ShootSearch.Common
{
    /// <summary>
    /// A tree type rule
    /// </summary>
    [TypeConverter(typeof(ExpandableConverter<TreeRule>))]
    public class TreeRule:Rule
    {
        /// <summary>
        /// Gets or sets the output format
        /// </summary>
        public string OutputFormat { get; set; }
        /// <summary>
        /// Gets or sets the match gourp name
        /// </summary>
        public string GroupName { get; set; }
        /// <summary>
        /// Gets or sets if the OutputHtml format
        /// </summary>
        public bool OutputHtml { get; set; }
        /// <summary>
        /// Children rules
        /// </summary>
        public List<TreeRule> Children { get; set; }
        public List<ReplaceRule> Filters { get; set; }


        #region Constructor
        public TreeRule()
            : base()
        {
            Children = new List<TreeRule>();
            Filters = new List<ReplaceRule>();
        }

        public TreeRule(string pattern)
            : base(pattern)
        {
            Children = new List<TreeRule>();
            Filters = new List<ReplaceRule>();
        }

        public TreeRule(string pattern, RegexOptions options)
            : base(pattern, options)
        {
            Children = new List<TreeRule>();
            Filters = new List<ReplaceRule>();
        } 
        #endregion

    }
}
